package ch.sv7.tool.dbmanager.db.torque;

import java.io.File;
import java.net.URL;
import java.util.Properties;

import junit.framework.TestCase;
import ch.sv7.tool.dbmanager.db.dialect.DefaultDialect;
import ch.sv7.tool.dbmanager.db.dialect.Dialect;
import ch.sv7.tool.dbmanager.db.xml.XmlTorqueDatabaseSchemaFactory;


public class XmlDatabaseTorqueTestCase extends TestCase {

	public void testTorqueReading() throws Exception {
		
		URL torqueFile = this.getClass().getResource("torque-file.xml");
		File folder = new File(torqueFile.getFile()).getParentFile();
		Dialect dialect = new DefaultDialect(null);
		XmlTorqueDatabaseSchemaFactory factory = 
			new XmlTorqueDatabaseSchemaFactory(folder, "*.xml", null, null, new Properties(), false, dialect);
	
		assertEquals(1, factory.getTables().length);
		assertEquals("audit_event", factory.getTables()[0]);
		
	}
}
